home *** CD-ROM | disk | FTP | other *** search
/ Gekikoh Dennoh Club 1 / Gekikoh Dennoh Club Vol. 1 (Japan).7z / Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin / kowin / archive / apl / tvv132.lzh / main.c < prev    next >
C/C++ Source or Header  |  1995-04-17  |  2KB  |  82 lines

  1. /*
  2.     MicroView.win Copyright 1995 小笠原博之
  3.     oga@dgw.yz.yamagata-u.ac.jp
  4. */
  5.  
  6. #include    "microview.h"
  7.  
  8. #define        DEFFONT        12
  9. #define        DEFCOL        80
  10. #define        DEFLIN        25
  11. #define        DEFTAB        8
  12.  
  13. int    WindowHeapSize=    1024*4;
  14.  
  15. static T_BUFP    BD= {
  16.         0, 0,
  17.         DEFTAB, DEFTAB-1, DEFCOL, 0,
  18.         DEFFONT/2, DEFFONT, DEFFONT,
  19.         AttrDefault, AttrDefault&3,
  20.         0, 0, 202, 140, DEFCOL*DEFFONT/2+14, DEFLIN*DEFFONT
  21.     };
  22.  
  23. BPopen( file )
  24. char    *file;
  25. {
  26.     T_BUFP    *bp;
  27.     if( bp= (void*)malloc( sizeof(T_BUFP) ) ){
  28.         int    flag;
  29.         char    path[256];
  30.         if( GETENV( "TVVPATH", 0, path ) < 0 )
  31.             s_strcpy( path, "." );
  32.         *bp= BD;
  33.         s_strcpy( bp->title, file );
  34.         flag= ReadFile( file, bp, path );
  35.         if( flag ){
  36.             MV_Open( bp->x, bp->y, bp->h, bp->v, bp );
  37.             return    TRUE;
  38.         }
  39.         free( bp );
  40.     }else
  41.         ConsoleAutoPrint( "tview:HEAP不足\r\n" );
  42.     return    FALSE;
  43. }
  44.  
  45. WindowMain( argc, argv )
  46. int    argc;
  47. char    **argv;
  48. {
  49.     argc= AnalyzeArgs( argc, (char**)argv, &BD.x, &BD.y, &BD.h, &BD.v );
  50.     for(; --argc ;){
  51.         if( **++argv == '-' ){
  52.             switch( (*argv)[1] ){
  53.             case 't':
  54.                 BD.tabsize= atoi2(*argv+2);
  55.                 BD.tabmask= BD.tabsize-1;
  56.                 break;
  57.             case 'a':
  58.                 BD.attr= atoi2(*argv+2);
  59.                 BD.backattr= BD.attr & AttrReverse ?
  60.                             BD.attr & 3 : 0;
  61.                 break;
  62.             case 'c':
  63.                 BD.maxcol= atoi2(*argv+2);
  64.                 break;
  65.             case 'f':
  66.                 BD.font_z= BD.font_y= atoi2(*argv+2);
  67.                 BD.font_x= BD.font_y/2;
  68.                 BD.h= BD.maxcol*BD.font_x+14;
  69.                 BD.v= DEFLIN*BD.font_y;
  70.                 break;
  71.             case 'F':
  72.                 BD.font_z= atoi2(*argv+2);
  73.                 break;
  74.             }
  75.         }else
  76.             BPopen( *argv );
  77.     }
  78.     if( !GlobalCount )
  79.         WindowSendSignal( WindowProcessID, SignalKill, 0 );
  80. }
  81.  
  82.